﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ucListProduct.ascx.cs"
    Inherits="SES.CMS.AdminCP.PageUC.ucListProduct" %>
<%@ Register Assembly="DevExpress.Web.ASPxGridView.v9.2, Version=9.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxGridView" TagPrefix="dxwgv" %>
<%@ Register Assembly="DevExpress.Web.ASPxEditors.v9.2, Version=9.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dxe" %>
<h2>
    Danh sách Sản phẩm</h2>
<div style="width: 100%; float: left; margin-bottom: 10px;">
    Lựa chọn theo danh mục sản phẩm :<asp:DropDownList runat="server" AutoPostBack="true"
        CssClass="ddl-input-x" ID="drpLoaiSanPham" OnSelectedIndexChanged="drpLoaiSanPham_SelectedIndexChanged"
        AppendDataBoundItems="true">
        <asp:ListItem Text=".: Lựa chọn danh mục :." Value="0"></asp:ListItem>
    </asp:DropDownList>
    <asp:DropDownList runat="server" AutoPostBack="true" ID="drpNhanHieu" OnSelectedIndexChanged="drpNhanHieu_SelectedIndexChanged"
        AppendDataBoundItems="true" Visible="false">
        <asp:ListItem Text="--All--" Value="0"></asp:ListItem>
    </asp:DropDownList>
    <span style="float: right;">Lọc theo tên sản phẩm
        <asp:TextBox runat="server" ID="txtProductFilter" CssClass="" Width="250px"></asp:TextBox>
        <asp:Button runat="server" ID="btnFilter" Text="Tìm kiếm" 
        onclick="btnFilter_Click" />
    </span>
</div>
<div style="float: left; width: 100%;">
    <asp:GridView ID="gvProduct" DataKeyNames="SanPhamID" runat="server" AutoGenerateColumns="False"
        Font-Size="12px" BackColor="White" BorderColor="#CC9966" BorderStyle="None" BorderWidth="1px"
        CellPadding="4" OnRowDeleting="gvProduct_RowDeleting" OnSelectedIndexChanged="gvProduct_SelectedIndexChanged"
        AllowPaging="True" PageSize="50" Width="100%" OnPageIndexChanging="gvProduct_PageIndexChanging"
        OnRowEditing="gvProduct_RowEditing">
        <RowStyle BackColor="White" ForeColor="#330099" HorizontalAlign="Center" VerticalAlign="Bottom" />
        <Columns>
            <asp:BoundField DataField="MaSanPham" HeaderText="Mã sản phẩm" ItemStyle-Width="10%"
                ItemStyle-HorizontalAlign="Left" />
            <asp:BoundField DataField="TenSanPham" HeaderText="Tên sản phẩm" SortExpression="TenSanPham"
                ItemStyle-Width="20%" ItemStyle-HorizontalAlign="Left" />
            <asp:TemplateField HeaderText="Đơn giá" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Right">
                <ItemTemplate>
                    <asp:Label runat="server" ID="lblDonGia" Text='<%#Eval("DonGia","{0:0,0}") %>'></asp:Label>
                    <asp:TextBox runat="server" ID="txtDonGia" Text='<%#Eval("DonGia") %>' Width="50px"
                        Visible="false"></asp:TextBox>
                </ItemTemplate>
                <EditItemTemplate>
                </EditItemTemplate>
            </asp:TemplateField>
            <%--<asp:BoundField DataField="DonGia" HeaderText="Đơn giá" SortExpression="DonGia" />--%>
            <asp:BoundField DataField="LoaiSanPham" HeaderText="Loại sản phẩm" SortExpression="LoaiSanPham" />
            <asp:BoundField DataField="NhanHieu" HeaderText="Nhãn hiệu" SortExpression="NhanHieu"
                Visible="false" />
            <asp:BoundField DataField="DonVi" HeaderText="Đơn vị tính" ItemStyle-Width="10%"
                ItemStyle-HorizontalAlign="Left" />
            <asp:TemplateField HeaderText="Xuất xứ">
                <ItemTemplate>
                    <asp:Label runat="server" ID="lblXuatXu" Text='<%#Eval("XuatXu")%>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:CheckBoxField DataField="SanPhamMoi" HeaderText="Sản phẩm nổi bật" />
            <asp:CheckBoxField DataField="SanPhamBanChay" HeaderText="Sản phẩm bán chạy" />
            <%--            <asp:TemplateField HeaderText="Hình ảnh">
                <ItemTemplate>
                    <img alt="images" width="100px" height="100px" src='../Media/<%#Eval("HinhAnh") %>' />
                </ItemTemplate>
            </asp:TemplateField>--%>
            <asp:TemplateField HeaderText="Thao tác">
                <ItemTemplate>
                    <asp:ImageButton ID="btEdit" runat="server" CommandName="Select" ImageUrl="~/AdminCP/images/edit_16x16.gif" />
                    <asp:ImageButton ID="btDelete" runat="server" CommandArgument='<%#Eval("SanPhamID") %>'
                        CommandName="Delete" ImageUrl="~/AdminCP/images/delete_16x16.gif" OnClientClick="return confirm('Có muốn xóa bản ghi này? Nhấn OK để xóa!')" />
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
        <FooterStyle BackColor="#FFFFCC" ForeColor="#330099" />
        <PagerStyle BackColor="#FFFFCC" ForeColor="#330099" HorizontalAlign="Center" VerticalAlign="Middle" />
        <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="#663399" />
        <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="#FFFFCC" />
    </asp:GridView>
    <br />
    <asp:Button ID="btnAdd" runat="server" OnClick="btnAdd_Click" Text="Thêm mới" />
    <asp:Button ID="btnUpdateAll" runat="server" OnClick="btnUpdateAll_Click" Text="Sửa đơn giá" />
    <asp:Button ID="btnUpdate" runat="server" OnClick="btnUpdate_Click" Text="Cập nhật"
        Visible="false" />
    <a href="Default.aspx?Page=AddMultiImg" title="Thêm ảnh sản phẩm">Thêm ảnh cho sản phẩm </a>
</div>
